﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

namespace Utility.NodeGraphs
{
	[AttributeUsage (AttributeTargets.Class)]
	public class NodeEditorAttribute : Attribute
	{
		public Type targetType;

		public NodeEditorAttribute (Type type)
		{
			targetType = type;
			if (!IsValid ())
			{
				throw new Exception ("Target type must be Node or its subclass");
			}
		}

		public bool IsValid ()
		{
			var t_nodegraph = typeof (Node);
			return targetType.Equals (t_nodegraph) || targetType.IsSubclassOf (t_nodegraph);
		}
	}
}